import 'package:dio/dio.dart';
import 'package:lcapp/api/request/api_client.dart';
import 'package:lcapp/api/request/response_data.dart';

class UserAPI {

  static Future<ResponseData> editMinInfo(Map<String,dynamic> info) async {
    ResponseData responseData = await ApiClient.post("/api/user/update/information",data: info);
    return ResponseData.createFrom(responseData, responseData.data);
  }

  static Future<ResponseData> getUserInfo(int uid) async {
    ResponseData responseData = await ApiClient.post("/api/user/get/login",data: {'uid':uid});
    return ResponseData.createFrom(responseData, responseData.data);
  }

  static Future<ResponseData> editRealInfo(FormData data) async {
    ResponseData responseData = await ApiClient.post("/api/aliocr/ocr",data: data,onSendProgress: (int progress, int total){
      print("当前进度是 $progress 总进度是 $total");
    });
    return ResponseData.createFrom(responseData, responseData.data);
  }

  static Future<ResponseData> submitRealInfo(Map data) async {
    ResponseData responseData = await ApiClient.post("/api/aliocr/submit",data: data,onSendProgress: (int progress, int total){
      print("当前进度是 $progress 总进度是 $total");
    });
    return ResponseData.createFrom(responseData, responseData.data);
  }

  static Future<ResponseData> getMinXianHuos(int id,int page,int size,{String? keyword, int choose = 2}) async {
    ResponseData responseData = await ApiClient.post("/api/merchandise/mylist",data: {'id':id,'page':page,'size':size,"keyword":keyword,'choose':choose});
    return ResponseData.createFrom(responseData, responseData.data);
  }

  static Future<ResponseData> getMinCollections(int id,int page,int size) async {
    ResponseData responseData = await ApiClient.post("/api/article/mycollection",data: {'id':id,'page':page,'size':size});
    return ResponseData.createFrom(responseData, responseData.data);
  }

  static Future<ResponseData> getMinVideos(int id,int page,int size) async {
    ResponseData responseData = await ApiClient.post("/api/video/getidVideo",data: {'issueId':id,'page':page,'size':size});
    return ResponseData.createFrom(responseData, responseData.data);
  }

  static Future<ResponseData> getMinLikces(int id,int page,int size) async {
    ResponseData responseData = await ApiClient.post("/api/alike/alikelist",data: {'uid':id,'page':page,'size':size});
    return ResponseData.createFrom(responseData, responseData.data);
  }

  static Future<ResponseData> followUser(int userdid) async {
    ResponseData responseData = await ApiClient.post("/api/follow/onfollow",data: {'userdid':userdid,});
    return ResponseData.createFrom(responseData, responseData.data);
  }

  static Future<ResponseData> searchUsers(String search,int page,int size) async {
    ResponseData responseData = await ApiClient.post("/api/user/searchUser",data: {'search':search,'page':page,'size':size});
    return ResponseData.createFrom(responseData, responseData.data);
  }

  static Future<ResponseData> deleteMinXianHuos(int ids) async {
    ResponseData responseData = await ApiClient.delete("/api/merchandise/delete/$ids",);
    return ResponseData.createFrom(responseData, responseData.data);
  }

  static Future<ResponseData> deleteMinVideos(int id) async {
    ResponseData responseData = await ApiClient.post("/api/video/deletevideo",data:{'id':id});
    return ResponseData.createFrom(responseData, responseData.data);
  }

  static Future<ResponseData> getMinMoney() async {
    ResponseData responseData = await ApiClient.post("/api/user/wallet",);
    return ResponseData.createFrom(responseData, responseData.data);
  }

  static Future<ResponseData> bindInvite(String code) async {
    ResponseData responseData = await ApiClient.post("/api/user/fillInvitation",data: {'invite':code});
    return ResponseData.createFrom(responseData, responseData.data);
  }

  static Future<ResponseData> getMinGoldDetail() async {
    ResponseData responseData = await ApiClient.get("/api/golddetail/detailgold",);
    return ResponseData.createFrom(responseData, responseData.data);
  }

  static Future<ResponseData> getMinMoneyDetail() async {
    ResponseData responseData = await ApiClient.get("/api/cashdetails/detailcash");
    return ResponseData.createFrom(responseData, responseData.data);
  }

  static Future<ResponseData> getMinSignDays() async {
    ResponseData responseData = await ApiClient.post("/api/user/signcount");
    return ResponseData.createFrom(responseData, responseData.data);
  }

  static Future<ResponseData> getMinWorks() async {
    ResponseData responseData = await ApiClient.post("/api/task/selectTask");
    return ResponseData.createFrom(responseData, responseData.data);
  }

  static Future<ResponseData> signToDay() async {
    ResponseData responseData = await ApiClient.post("/api/user/sign");
    return ResponseData.createFrom(responseData, responseData.data);
  }

  static Future<ResponseData> changeGold(int gold) async {
    ResponseData responseData = await ApiClient.post("/api/user/getinreturn1",data: {'gold':gold});
    return ResponseData.createFrom(responseData, responseData.data);
  }

  static Future<ResponseData> aliPay(int vipId) async {
    ResponseData responseData = await ApiClient.post("/api/alipay/trade/app/$vipId");
    return ResponseData.createFrom(responseData, responseData.data);
  }

  static Future<ResponseData> wxPay(int vipId) async {
    ResponseData responseData = await ApiClient.post("/api/wxpay/app/$vipId");
    return ResponseData.createFrom(responseData, responseData.data);
  }

  static Future<ResponseData> applePay(int vipId) async {
    ResponseData responseData = await ApiClient.post("/api/applePay/app/$vipId");
    return ResponseData.createFrom(responseData, responseData.data);
  }

  static Future<ResponseData> applePayCheck(Map<String,dynamic> data) async {
    ResponseData responseData = await ApiClient.post("/api/applePay/check",queryParameters: data);
    return ResponseData.createFrom(responseData, responseData.data);
  }

  static Future<ResponseData> minGetMoney(Map<String,dynamic> data) async {
    ResponseData responseData = await ApiClient.post("/api/withdraw/application",data: data);
    return ResponseData.createFrom(responseData, responseData.data);
  }

  static Future<ResponseData> minGetMoneyList(Map<String,dynamic> data) async {
    ResponseData responseData = await ApiClient.post("/api/withdraw/myWithdraw",data: data);
    return ResponseData.createFrom(responseData, responseData.data);
  }

  static Future<ResponseData> getMinYixiang(int page,int size,int uid) async {
    ResponseData responseData = await ApiClient.post("/api/alike/alikeUser",data: {
      'page':page,
      'size':size,
      'uid':uid
    });
    return ResponseData.createFrom(responseData, responseData.data);
  }

  static Future<ResponseData> getMinFans() async {
    ResponseData responseData = await ApiClient.post("/api/follow/selectfans");
    return ResponseData.createFrom(responseData, responseData.data);
  }

  static Future<ResponseData> getMinFollows() async {
    ResponseData responseData = await ApiClient.post("/api/follow/selectfollow");
    return ResponseData.createFrom(responseData, responseData.data);
  }

  static Future<ResponseData> getVipList() async {
    ResponseData responseData = await ApiClient.get("/api/vipType/vipList");
    return ResponseData.createFrom(responseData, responseData.data);
  }

  static Future<ResponseData> getFeedBackList() async {
    ResponseData responseData = await ApiClient.get("/api/feedbackType/feedbackTypeList");
    return ResponseData.createFrom(responseData, responseData.data);
  }

  static Future<ResponseData> saveFeedBack(Map<String,dynamic> map) async {
    ResponseData responseData = await ApiClient.post("/api/feedback/feedbackInfo",data: map);
    return ResponseData.createFrom(responseData, responseData.data);
  }

  static Future<ResponseData> saveReport(Map<String,dynamic> map) async {
    ResponseData responseData = await ApiClient.post("/api/report/save",data: map);
    return ResponseData.createFrom(responseData, responseData.data);
  }

  static Future<ResponseData> saveMyJYaddress(Map<String,dynamic> map) async {
    ResponseData responseData = await ApiClient.post("/api/address/save",data: map);
    return ResponseData.createFrom(responseData, responseData.data);
  }

  static Future<ResponseData> updateMyJYaddress(Map<String,dynamic> map) async {
    ResponseData responseData = await ApiClient.post("/api/address/update",data: map);
    return ResponseData.createFrom(responseData, responseData.data);
  }

  static Future<ResponseData> getMyJYaddressList(Map<String,dynamic> map) async {
    ResponseData responseData = await ApiClient.post("/api/address/mylist",data: map);
    return ResponseData.createFrom(responseData, responseData.data);
  }

  static Future<ResponseData> deleteMyJYaddress(int aid) async {
    ResponseData responseData = await ApiClient.delete("/api/address/delete/$aid");
    return ResponseData.createFrom(responseData, responseData.data);
  }

}